Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System to pick a translation language for each keyboard #476

Merged
merged 51 commits into from
Nov 10, 2024

Conversation

Jag-Marcel
Copy link
Member

@Jag-Marcel Jag-Marcel commented Jul 26, 2024

Contributor checklist


Description

This PR creates a menu for each keyboard, where you can choose a language to be used for Scribe's translation feature. Previously, every keyboard would require English as the translation language.

Related issues

Blocked by

Removed unnecessary function from project and simplified a switch case:
Are these required or is it fine to remove them?
- Minor refactor to code for the button
- Reworked how the chevron is displayed on the button
- Added a label to the left of the chevron
- Resized elements of the button to be centred instead of slightly lower than the centre
- Added a button to language settings for picking a translation language
- Created temporary value to store currently selected translation language, the plan is for every keyboard to have one of these
+ in progress class for the new view
- Selection now changes translationLanguage variable
- Radio icons change based on selection
- Now saves a specific translation language for each keyboard instead of one value
- Simplified saving the variables for each language using UserDefaults
- Translation query now asks for the controller language's specified translation language or sets a default if it's missing
- Removed some unnecessary code
Copy link

github-actions bot commented Jul 26, 2024

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and iOS rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

  • The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution

    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local Scribe-iOS repo
  • The linting and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis andrewtavis self-requested a review July 26, 2024 16:25
Jag-Marcel and others added 5 commits July 26, 2024 18:33
cd28e5e Merge pull request scribe-org#25 from weblate/weblate-scribe-scribe-i18n
dc922d8 Translated using Weblate (Swedish)
997460b Translated using Weblate (Spanish)
a99deb4 Translated using Weblate (German)
eff6dee Merge pull request scribe-org#24 from Jag-Marcel/new-strings
7ad62b4 Merge branch 'main' into new-strings
b020823 Merge pull request scribe-org#23 from weblate/weblate-scribe-scribe-i18n
463dd85 New strings for Scribe-iOS translation picker
dde9e54 Translated using Weblate (Swedish)
65d4274 Translated using Weblate (Swedish)
f2c989d Translated using Weblate (Swedish)
d230853 Merge pull request scribe-org#22 from Jag-Marcel/minor-fix
dc219d4 Minor fix to conversion script

git-subtree-dir: Scribe/i18n
git-subtree-split: cd28e5e4ad8f50026e6e4d5b63e489819152e1e6
d9b2226 Merge pull request scribe-org#26 from Jag-Marcel/action-fix
0cb65ed Small fix to action for converting jsons to xcstrings

git-subtree-dir: Scribe/i18n
git-subtree-split: d9b22262f3769545a08bd4772cae20caa2f23c67
@andrewtavis
Copy link
Member

Thanks for the detailed PR and fixing the merge conflicts, @Jag-Marcel!

@andrewtavis
Copy link
Member

Brought in the localizations to main so that we can get v3.1 out, @Jag-Marcel 😊 Would be great if we can get a "Follow us on Mastodon" localization key in! I'll bring in everything else and send along v3.1 now though as I'd like to get it out today. No stress on one menu option not being fully localized :)

@Jag-Marcel Jag-Marcel mentioned this pull request Aug 3, 2024
1 task
@andrewtavis
Copy link
Member

Very sorry for the wait on all this, @Jag-Marcel! Thanks so much for your patience :) d4e2b0a sends along new language DBs without a translation table, and then there's a common TranslationData.sqlite DB that we can now use for translation. This will be consistent even post Outreachy, and we won't need to worry about a single language DB being assigned anymore.

How do you want to proceed here? Would you want to finalize the new process via the SQLite access of the new TranslateData.sqlite DB? Anything I can do to support?

@Jag-Marcel
Copy link
Member Author

@andrewtavis I'll look into this and tell you if I need anything, glad that the process and everything is finally figured out!

Jag-Marcel and others added 10 commits November 8, 2024 16:56
Translations from any language to any other language are now functional.
LanguageDBManager has been changed to use the `translations` static instance for the translation database and `shared` for the current language's database.
8c13530 Merge pull request scribe-org#73 from yerimmii/ko-json
bc78915 Create ko.json
3f2a3de Minor edit to .gitignore for spacing
e40d892 Merge pull request scribe-org#72 from axif0/bangla
1afc6ea Creating Bangla localization
23c56ed Merge pull request scribe-org#70 from KesharwaniArpita/ArpitaContributionsMarathi
d49ed68 Create string.xml
7dc4b73 Create mr.json (Marathi)
6bc6502 Merge pull request scribe-org#69 from axif0/work
933237d Update pr_maintainer_checklist.yaml
fa75400 Merge pull request scribe-org#68 from OmarAI2003/MSA-internationalization
329ad53 Translate from en to ar
c81e3a1 Add Arabic translation file (ar.json) for localization support
45bce87 Merge pull request scribe-org#66 from OmarAI2003/improve-android-convert-str-to-json
b774027 Minor spacing and removing permissions error
a3eeda1 Merge pull request scribe-org#67 from weblate/weblate-scribe-scribe-i18n
c67255b Translated using Weblate (Spanish)
7054971 fix: add check for missing values_directory
a90a040 Error handling for file read and write operations
9295291 Use a single variable for the 'jsons' folder path and add error handling for missing 'jsons' folder.
5e85b16 Merge pull request scribe-org#64 from OmarAI2003/improve-android-convert-jsons-to-strings
94482ef Added docstrings to Android string conversion functions
2a7b35b for the recently supported language: adding the 'hi' language folder generated by the script to prevent 'directory not found' errors when testing the reverse conversion (JSON to strings).
13a4849 small fix to the lang_dir
e5ca964 Refactor: Pre-load language JSON files before generating strings.xml files
f8ffe63 Use a single variable for the 'jsons' folder path and add error handling for missing 'jsons' folder.
7dbeaa1 Merge pull request scribe-org#62 from OmarAI2003/improve-convert-jsons-to-xcstrings
a3e5fbf Minor edits to script spacing and comments
5fb2fc5 Merge pull request scribe-org#63 from KesharwaniArpita/ArpitaContributionsHindi
fd91955 Create hi.json
9fcc0de fix: update inline comments to start with lowercase as per style guide.
8925a4b Rename variable for improved clarity
aee58c0 Add error handling for missing base language file
d41c8eb Remove automatic creation of the 'jsons' folder
d811de7 Optimize performance by pre-loading language JSON files
81da648 Refactor: Use a single variable for the 'jsons' folder path and ensure it exists.
f354bb4 Fix file handling: Use context managers to ensure safe reading and writing of files.
13d52f2 Merge pull request scribe-org#58 from OmarAI2003/improve-convert-xcstrings-to-jsons
8b13ee6 Fix to en.json being written rather than en-US + minor edits
2a7e03d Merge pull request scribe-org#61 from weblate/weblate-scribe-scribe-i18n
f0abf87 Translated using Weblate (French)
6c4acae Merge pull request scribe-org#60 from OmarAI2003/fix-typo-in-readme.md
d30380a Revert: Move Localizable.xcstrings back to original location
46a68da moved Localizable.xcstrings again where it was as andrew told me
d426a4b Fix typo in README: Changed 'an tools' to 'tools'
0d48009  made the changes as per the feedback and added Localizable.xcstrings to 'jsons' directory
42e76dd Improve language handling and ensure directory creation
b1ccff7 Refactor: Use context manager for writing JSON files to ensure proper file handling.
5b97d83 Add JSON loading error handling in convert_xcstrings_to_jsons.py
32b8f70 Improve file handling in convert_xcstrings_to_jsons.py
7536be6 Update app menu headings to not include second word caps
c286cf2 Merge pull request scribe-org#50 from weblate/weblate-scribe-scribe-i18n
3038710 Translated using Weblate (Spanish)
b80ddc7 Translated using Weblate (Spanish)
faf7ce3 Various fixes of strings and adding conjugate keys
1eb7d47 Minor update to readme headers
04574f8 Remove unused keys and fix colon spacing
8492a7a Make sure that application names are not localized
0ac6710 Merge pull request #48 from weblate/weblate-scribe-scribe-i18n
80708cb Translated using Weblate (Spanish)
dd15564 Merge pull request #47 from weblate/weblate-scribe-scribe-i18n
f05f74d Translated using Weblate (Spanish)
5701774 Add missing and update incorrect strings
c0a45c2 Merge pull request #46 from angrezichatterbox/Run-Json-to-XML-Scripts
3af18ab feat:Ran the script for converting json to xml
935903a Edit working directory for conversion workflows to try to fix error
c60a196 Merge pull request #45 from weblate/weblate-scribe-scribe-i18n
fc18213 Translated using Weblate (Spanish)
872d232 Set working directory for conversion scripts
2f6f5ab Fix incorrect keys in translation language JSONs
feb4a18 Edit to conversion scripts to fix their paths with relation to root
d6cce32 Fix German GitHub key
c26c78d Add all app texts for scribe + conjugate with new keys
ad588cc Update the suggested room based on new room name
1e07813 Merge pull request #42 from angrezichatterbox/XML-TO-JSON-FIX
2a8fe2a fix:Added escape characters for \n
924f00c scribe-org#37 minor edits to conversion scripts and try new command path
aafa0f6 scribe-org#37 update Scribe-i18n structure and fix conversion workflow
6a8faaa Merge pull request scribe-org#39 from Jag-Marcel/i18n-refactor
2b9caff Added newline at end of all JSON files
e775e46 Updated jsons and xcstrings file using new iOS scripts
dd018c1 Refactored iOS conversion scripts to use python json package
7f8c273 Updated conversion workflow to use paths filter instead of conditional check
ff21cdb Refactored scripts into new iOS and Android folders
700a3ce Update Android strings given new conversion script
1ba25e6 Remove reference to contribution guide as it's been removed
5f38e75 Merge pull request scribe-org#38 from angrezichatterbox/special_character_check_xml
40d1edb feat:Added special character replacement in the Script
d9a35d7 Minor update of readme to make subtree creation more clear
10b07b5 Merge pull request scribe-org#36 from angrezichatterbox/xml_conversion
dcad620 Run stings conversion script + workflow for Android + docs
8b65382 feat:Added script for conversion from strings.xml to json
cea2273 feat:Added script for conversion from json to strings.xml
b25df32 Revert change to conversion to see if adding the full path will make it work
18d50ca Merge pull request scribe-org#35 from Jag-Marcel/xcode-script-fix
b8a1598 Merge pull request scribe-org#34 from wkyoshida/20
7aeba36 Removed conditional from action
cf9878e docs: Add documentation on using Scribe-i18n as a git subtree
307cadc Merge pull request scribe-org#33 from Jag-Marcel/xcode-script-fix
44fa905 Removed quotes around bool value

git-subtree-dir: Scribe/i18n
git-subtree-split: 8c13530b51716c2e2f38be2565b6ef1f5a3d4188
718ab45 Update all xcstrings and strings files given new localizations

git-subtree-dir: Scribe/i18n
git-subtree-split: 718ab455576ee1a0323a7c884d5f99520b8c15d1
@andrewtavis
Copy link
Member

Ok we're good to go with the .xcstrings file, @Jag-Marcel 😊 I guess that I just didn't have Korean locally, which is what came down with the git pull --rebase --autostash :) See you tomorrow!

- Localization keys are now in tune with current i18n progress
- Added full privacy policy instead of a reference to the English version of the app
- Unutilized code for the lists in the third party view that caused problems has been removed. Lists aren't indented anymore but it doesn't look any worse in my opinion.  I left the function to add indents in for now, just in case
- Created a new function for pairing strings with themselves in a dictionary (used to pair hyperlinks with themselves). This is more general than the more static approach we had before. I also refactored two previous methods to use this
- Simplified keyboard settings to be more dynamic instead of manually defining the same section from SettingsTableData again
@Jag-Marcel
Copy link
Member Author

Jag-Marcel commented Nov 9, 2024

The localization not working was because we still had the old string keys in iOS, but I also had to disable the indents in the third party licenses for now because of the way we generated them. Could probably be reactivated in a future issue but do we even want to have them? I think the lists there looks fine even without indents.

Also we probably want to find a way to detect links in texts like the privacy policy and licenses. I refactored the way we add them here so we only need to add each link to a list once, but ideally we should have a way to find them from specific texts automatically.

I don't know what happened with the history but somehow these changes were removed?
@andrewtavis
Copy link
Member

Ah totally true, @Jag-Marcel! This PR then also closes #503 🚀 Thank you!

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So happy to have this merged, @Jag-Marcel! Thanks so much for the hard work and determination to see this through to the end 😊 The implementation exceeds expectations given its everything we were looking for + your improvements to the user flow with the language being selected directly. Such an amazing step towards making Scribe an accessible application to language learners from all over the world 🌐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants